# -*- coding: utf-8 -*-
# @Time    : 2021/4/27 21:38
# @Author  : lilehao
# @Email   : 2811894942@qq.com
# @File    : 正则表达式作业.py


# #<a href="https://www.ksyun.com/"><img src="/upload/links/%E9%87%91%E5%B1%B1%E4%BA%91.jpg" alt=""></a>
# import  requests
# import  re
# photo = []
# ret1 = requests.get("https://www.sanchuangedu.cn/")
# ret2 = ret1.text
# #print(ret2)
# ret3 = re.findall(r"(?:<.*?>)*<img src\=\"(.*)\" .*?>(?:<.*?>)*",ret2,re.I)
#
# for i in ret3:
#     photo.append("https://www.sanchuangedu.cn/"+i)
# print(photo)
#
# i = 1
# for j in photo:
#     r = requests.get(j)
#     print(f"图片{i}下载中")
#     dir = "./sanchuang_pic" + str(i) + ".jpg"
#     fp = open(dir, 'wb')
#     fp.write(r.content)
#     fp.close()
#     i += 1
# print("图片下载成功")